<%
'******************************************************************************************
'#          Openasp CMS software opensource                                               #
'******************************************************************************************
'#      Copyright (C) Luca Becchetti, Broken Ice Interactive                              #
'#                                                                                        #
'# Questo software è gratuito, è possibile ridistribuire e modificare il prodotto         #
'# rispettando i termini della GNU General Public License pubblicata dalla Free           #
'# Software Foundation, si fa riferimento alla versione attuale e a tutte le versioni.    #
'# future                                                                                 #
'#                                                                                        #
'# Il software viene distribuito con lo scopo di essere utile e di aiutare nella          #
'# realizzazione di un sito web, non ci assiumiamo nessuna responsabilità per             #
'# eventuali malfunzionamenti o problemi provenienti dal programma.                       #
'#                                                                                        #
'# E' assolutamente vietato eliminare ogni riferimento di copyright sia all'interno del   #
'# del codice sorgente sia quelli visivi nel progetto.                                    #
'#                                                                                        #
'# Una copia della licenza GNU GPL è rilasciata nel pacchetto di istallazione del         #
'# software.                                                                              #
'#                                                                                        #
'# Per supporto visita il nostro sito ufficiale                                           #
'# http://www.openasp.it                                                                  #
'#                                                                                        #
'#                                                                                        #
'******************************************************************************************
'
'--------------------------------------------------------------------------------------------

i = split(request.ServerVariables("HTTP_URL"), "/")
if strComp("hello.asp", i(Ubound(i)), 1) = 0 then
  response.redirect request.servervariables("HTTP_REFERER")
end if
%>

<div id="position">
	<a href="admin.asp" class="testo">Control Center</a> &raquo; <%=traduci("ling_blog_14")%>
</div>
<div id="page">

	<h2><%=Ucase(traduci("ling_blog_14"))%></h2>
<dl>
		<dt>
			<a title="<%=traduci("ling_blog_15")%>" href="admin.asp?modulo=blog&amp;op=crea" class="testo">
				<img src="themes/MODULI_IMG/MODULO_BLOG/NEWS_IMG_02.gif" alt="<%=traduci("ling_blog_15")%>" border="0" />
            </a>
		</dt>
		<dd>
			<a title="<%=traduci("ling_blog_15")%>" href="admin.asp?modulo=blog&amp;op=crea" class="testo"><%=traduci("ling_blog_8")%></a>
		</dd>
	</dl>
	<dl>
		<dt>
			<a title="<%=traduci("ling_blog_16")%>" href="admin.asp?modulo=blog&amp;op=postmanage" class="testo">
				<img src="themes/MODULI_IMG/MODULO_BLOG/NEWS_IMG_03.gif" alt="<%=traduci("ling_blog_16")%>" border="0" />
			</a>
		</dt>
		<dd>
			<a title="<%=traduci("ling_blog_16")%>" href="admin.asp?modulo=blog&amp;op=postmanage" class="testo"><%=traduci("ling_blog_9")%></a>
		</dd>
	</dl>
	<% if isADM(session("uID"), "blog") OR session("livelloUser") = 2 then %>
	<dl>
		<dt>
			<a title="<%=traduci("ling_blog_18")%>" href="admin.asp?modulo=blog&amp;op=gestione_cat" class="testo">
            	<img src="themes/MODULI_IMG/MODULO_BLOG/NEWS_IMG_06.gif" alt="<%=traduci("ling_blog_18")%>" border="0" />
            </a>
		</dt>
		<dd>
			<a title="<%=traduci("ling_blog_18")%>" href="admin.asp?modulo=blog&amp;op=gestione_cat" class="testo"><%=traduci("ling_blog_11")%></a>
		</dd>
	</dl>
	<dl>
		<dt>
			<a title="<%=traduci("ling_blog_19")%>" href="admin.asp?modulo=blog&amp;op=gestione_utenti" class="testo">
          	  <img src="themes/MODULI_IMG/MODULO_BLOG/NEWS_IMG_07.png" alt="<%=traduci("ling_blog_19")%>" border="0" />
            </a>
		</dt>
		<dd>
			<a title="<%=traduci("ling_blog_19")%>" href="admin.asp?modulo=blog&amp;op=gestione_utenti" class="testo"><%=traduci("ling_blog_12")%></a>
		</dd>
	</dl> 
    <dl>
		<dt>
			<a title="<%=traduci("ling_blog_20")%>" href="admin.asp?modulo=blog&amp;op=config" class="testo">
          	  <img src="themes/MODULI_IMG/MODULO_BLOG/NEWS_IMG_04.gif" alt="<%=traduci("ling_blog_20")%>" border="0" />
            </a>
		</dt>
		<dd>
			<a title="<%=traduci("ling_blog_20")%>" href="admin.asp?modulo=blog&amp;op=config" class="testo"><%=traduci("ling_blog_13")%></a>
		</dd>
	</dl>                
	<%end if%>
    <br style="clear:both" /><br />
    <h2>bacheca</h2>
    <%
function removeHtmlChar(ss)
	l=len(ss)
	for i=1 to l
		ch=mid(ss,i,1)
		x=i
		if(ch="<") then
			x=i
			do while(mid(ss,x,1)<>">")
				x=x+1		
			loop
			t=t & " "
		else
			t=t & ch	
		end if
		i=x	
	next
	ss=t
end function

Function TextPreview(strText, nChars)
	Dim nPos

    	' Uncomment next line to replace line breaks with spaces
	' strText = Replace(strText, vbCrLf, " ")

	' Check if it's longer than limit
    	If Len(strText) > nChars And nChars > 4 Then
        	' Find the end of last whole word that we can use
        	nPos = InStrRev(Left(strText, nChars - 3), " ")

        	If nPos > 0 Then
			' Take whole words only 
            		TextPreview = Left(strText, nPos) & "..."
        	Else
			' No spaces were found - take what we can
            		TextPreview = Left(strText, nChars - 4) & " ..."
	        End If
    	Else
		' Take nChars from the text
        	TextPreview = Left(strText, nChars)
    	End If
End Function	
%>
<div style="width:50%; float:left;">
<b><%=traduci("ling_blog_66")%></b><br /><br />
<%
	set cm = addConn.Execute("SELECT * FROM tb_blog_commenti WHERE data <= '" & DateToSTR(STR_TIME) & "' ORDER BY pubblico ASC, data DESC")
	If not cm.eof then
		for i = 0 to 10
			if not cm.eof then
				response.Write "<b>"&traduci("ling_blog_68")&"</b> " & cm("nome") & " " & traduci("ling_blog_65") & " "
				Set p = addConn.Execute("Select titolo from tb_blog_posts WHERE id_post = " & cm("post"))
				response.Write "<a href=""default.asp?modulo=blog&amp;pass=1&amp;idpost="&cm("post")&""" class=""testo"" target=""_blank"">" & p("titolo") & "</a>"
				set p = Nothing
				if cm("pubblico") = 0 then
					response.Write " (<a href=""admin.asp?modulo=blog&amp;op=comment&amp;id="&cm("post")&""" class=""testo"">" & traduci("ling_blog_70") & "</a>)"
				end if
				response.Write "<br />"
				cm.MoveNext
			end if
		next
	end if
	set cm = Nothing
	%>
</div>
<div style="width:50%; float:left;">
<b><%=traduci("ling_blog_67")%></b><br /><br />
<%
	set cm = addConn.Execute("SELECT * FROM tb_blog_posts WHERE data <= '" & DateToSTR(STR_TIME) & "' ORDER BY pubblico ASC, data DESC")
	If not cm.eof then
		for i = 0 to 10
			if not cm.eof then
				response.Write "<b>"&traduci("ling_blog_69")&"</b> " & cm("titolo") & " " & traduci("ling_blog_65") & " "
				Set p = addConn.Execute("Select nome_categoria from tb_blog_categorie WHERE id_categoria = " & cm("categoria"))
				response.Write "<a href=""default.asp?modulo=blog&amp;pass=2&amp;cat="&cm("categoria")&""" class=""testo"" target=""_blank"">" & p("nome_categoria") & "</a>"
				set p = Nothing
				if cm("pubblico") = 0 then
					response.Write " (<a href=""admin.asp?modulo=blog&op=modifica_post&id="&cm("id_post")&""" class=""testo"">" & traduci("ling_blog_70") & "</a>)"
				end if
				response.Write "<br />"
				cm.MoveNext
			end if
		next
	end if
	set cm = Nothing
	%>
</div>

</div>